//
//  UIBarButtonItem+Extension.swift
//  WeiBo(Swift)
//
//  Created by 周成龙 on 16/9/23.
//  Copyright © 2016年 ZCL. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
    
    convenience init(imageName: String, target: Any?, action: Selector?) {
        let btn = UIButton(type: UIButtonType.custom)
        btn.setImage(UIImage(named: imageName), for: UIControlState.normal)
        btn.setImage(UIImage(named: imageName+"_highlighted"), for: UIControlState.highlighted)
        btn.addTarget(target, action: action!, for: UIControlEvents.touchUpInside)
        btn.sizeToFit()
        self.init(customView: btn)
    }
}
